﻿/* 
 * Rug.Cmd part of Rugland Console Framework
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Copyright (C) 2008 Phill Tew. All rights reserved.
 * 
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace Rug.Cmd
{
    /// <summary>
    /// Base interface for all ArgumentParser Arguemnts
    /// </summary>
    public interface IArgumentValue
    {
        /// <summary>
        /// Get short string for the command line usage readout
        /// </summary>
        string ArgumentString();

        /// <summary>
        /// Gets the short help string 
        /// This is the string that is seen when the user is show a overview of all the arguments
        /// </summary>
        string ShortHelp { get; }

        /// <summary>
        /// Gets the long help string 
        /// This is the string that is seen when the user is show the spacific usage for this argument
        /// </summary>
        string Help { get; }

        /// <summary>
        /// Gets or sets a value indicating whether this argument was defiend in the parsed command line
        /// </summary>
        bool Defined { get; set; }

        /// <summary>
        /// Set the value of this argument
        /// </summary>
        /// <param name="value">string value</param>
        /// <returns>true if the value was parsed</returns>
        bool SetValue(string value);

        /// <summary>
        /// Get the object value of this argument 
        /// </summary>
        object ObjectValue { get; }

        /// <summary>
        /// Parse values from arguments array
        /// </summary>
		/// <param name="parser">the parser that is currently parsing this arguemnt</param>
        /// <param name="key">the key that matched</param>
        /// <param name="arguments">the full arguments array</param>
        /// <param name="index">the current arguemnt index</param>
        /// <returns>true if this argument should now become the current argument, otherwise false</returns>
        bool Parse(ArgumentParser parser, string key, string[] arguments, ref int index);

        /// <summary>
        /// Undefines the argument and resets it to its default value
        /// </summary>
        void Reset();
    }
}
